// import { DeviceEventEmitter } from 'react-native';
import {createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers/index';

// const Config = {};

export default function configureStore(initialState) {
  const store = createStore(
    rootReducer,
    initialState,
    applyMiddleware(thunk), //applyMiddleware方法中传入需要使用的中间件
  );

  // 触发监听事件
  // store.subscribe(() => {
  //   DeviceEventEmitter.emit(Config.EVENT_GLOBAL_STATE_CHANGE, {});
  // });
  global.AppReduxStore = store;

  return store;
}
